package com.serviceprovider.business.module.sp.preferences.model;

//~--- non-JDK imports --------------------------------------------------------

import com.serviceprovider.business.module.admin.user.model.Saveable;
import com.serviceprovider.business.module.user.model.impl.User;

/**
 * Model object for 'preferences' table
 *
 * @author mrduongnv@gmail.com
 */
public class Preferences extends Saveable {

    /** serialVersionUID */
    private static final long serialVersionUID = 108441106611417892L;
    private Integer           bonus;
    private Integer           comission;
    private Integer           customFee;
    private User              user;

    public Integer getBonus() {
        return bonus;
    }

    public void setBonus(Integer bonus) {
        this.bonus = bonus;
    }

    public Integer getComission() {
        return comission;
    }

    public void setComission(Integer comission) {
        this.comission = comission;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Integer getCustomFee() {
        return customFee;
    }

    public void setCustomFee(Integer customFee) {
        this.customFee = customFee;
    }

    @Override
    public boolean equals(Object obj) {
        if ((obj == null) ||!(obj instanceof Preferences)) {
            return false;
        }

        Preferences b      = (Preferences) obj;
        boolean     result = true;

        result &= ((this.getId() == null) && (b.getId() == null))
                  || ((this.getId() != null) && this.getId().equals(b.getId()));
        result &= ((user == null) && (b.user == null)) || ((user != null) && user.equals(b.user));
        result &= ((bonus == null) && (b.bonus == null)) || ((bonus != null) && bonus.equals(b.bonus));
        result &= ((customFee == null) && (b.customFee == null))
                  || ((customFee != null) && customFee.equals(b.customFee));
        result &= ((comission == null) && (b.comission == null))
                  || ((comission != null) && comission.equals(b.comission));

        return result;
    }

    @Override
    public int hashCode() {
        int prime  = 31;
        int result = 1;

        result = prime * result + ((this.getId() == null)
                                   ? 0
                                   : this.getId().hashCode());
        result = prime * result + ((user == null)
                                   ? 0
                                   : user.hashCode());
        result = prime * result + ((bonus == null)
                                   ? 0
                                   : bonus.hashCode());
        result = prime * result + ((customFee == null)
                                   ? 0
                                   : customFee.hashCode());
        result = prime * result + ((comission == null)
                                   ? 0
                                   : comission.hashCode());

        return result;
    }
}



